/*
*Copyright (c) Nikhil Jain.
*Project ICARUS, communications and 
*artificial intelligence.
*/



package javadrone.agent.demo;

//~--- non-JDK imports --------------------------------------------------------

import javadrone.agent.ExtendedAgent;

import simbad.demo.Demo;

import simbad.sim.*;

//~--- JDK imports ------------------------------------------------------------

import javax.vecmath.Color3f;
import javax.vecmath.Vector3d;
import javax.vecmath.Vector3f;

public class ExtendedAgentDemo extends Demo {
    public ExtendedAgentDemo() {
        setWorldSize(10f);
        boxColor = new Color3f(0.6f, 0.5f, .3f);
        add(new Box(new Vector3d(1, 1, -7), new Vector3f(1f, .53f, 0.55f), this));
        add(new Box(new Vector3d(2, 0, 3), new Vector3f(0.5f, 1f, 1f), this));

        // Add a robot.
        add(new Robot(new Vector3d(0, 0, 0), "ExtendedAgentRobot"));
    }

    // derive from class KheperaRobot instead of class Agent
    public class Robot extends ExtendedAgent {
        public Robot(Vector3d position, String name) {
            super(position, name);
        }

        /** Perform one step of Agent's Behavior */
        @Override
        public void performBehavior() {

            // System.out.println("Performing behaviour..");
            setRotationalVelocity(new Vector3d(0.1, 0.1, 0.1));
            setTranslationalVelocity(new Vector3d(0.1, 0.1, 0.3));

            if (collisionDetected()) {
                moveToStartPosition();
            }
        }
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
